package collections;
import java.util.HashSet;
import java.util.Set;


public class SetExample {
	
	/*finding duplicates.*/ 
	public static void main(String[] args) {
		
		String[] arraystr={"about","to","learn","java","about","to","use"};
		Set<String> s = new HashSet<String>();
		
		for (String a : arraystr)
			if (!s.add(a))	                				 
				System.out.println("Duplicate detected: " + a);
 
		System.out.println(s.size() + " distinct words: " + s);   
	}
}
